package com.simpns.io;

/**
 *  
 *
 * @author gzc
 * @Description: TODO(用一句话描述该文件做什么)
 * @date 2023-08-05 下午 5:43
 */

public enum IODevErrorCode {

    S_IOEXTEND_NORMAL(6901, "正常返回"),
    W_IOEXTEND_INVALIDPARAM(6921, "传入的参数是无效的"),
    E_IOEXTEND_COMMERR(6941, "初始化COM组件错误"),
    E_IOEXTEND_INVAILDCOMMAND(6942, "无效的命令"),
    E_IOEXTEND_DOOR_COMMANDERROR(6943, "读门状态命令错"),
    E_IOEXTEND_DOOR_GETSTATUSERROR(6944, "门操作超时"),
    E_IOEXTEND_DOOR_TIMEOUT(6945, "金额不足，找零失败"),
    E_IOEXTEND_LIGHT_COMMANDERROR(6946, "指示灯状态命令错"),
    E_IOEXTEND_LIGHT_SETSTATUSERROR(6947, "设置指示灯状态错"),
    E_IOEXTEND_LIGHT_GETSTATUSERROR(6948, "取指示灯状态错"),
    E_IOEXTEND_LIGHT_TIMEOUT(6949, "灯操作超时"),
    E_IOEXTEND_TIMEOUT(6999, "IO扩展板操作超时");
    private int code;
    private String text;

    IODevErrorCode(int code, String text) {
        this.code = code;
        this.text = text;
    }

    public static String find(int code) {
        for (IODevErrorCode each : IODevErrorCode.values()) {
            if (each.code == code) {
                return each.text;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getText() {
        return text;
    }
}
